package com.sage.dao.impl;


import org.hibernate.Hibernate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.sage.commons.dao.BaseDao;
import com.sage.dao.IndustryDao;
import com.sage.dao.model.Industry;


@SuppressWarnings("unchecked")
@Repository
public class IndustryDaoImpl extends BaseDao<Industry, Long> implements IndustryDao{

	@Transactional(readOnly=true)
	@Override
	public Industry findByKey(String pnKey) {
		Industry industry = getByHQL("FROM Industry as industry WHERE industry.pn_key=?", pnKey);
		Hibernate.initialize(industry.getCompanys());
		return industry;
	}
	
}
